<html>
   <head>
      <link rel="stylesheet" type="text/css" href="style.css" />
   </head>
   <body onload="">
<h2 class="comptitle">NED File <i>src/common/BaseOverlay.ned</i></h2>
<table class="typetable">
   <tr>
      <th>Name</th>
      <th>Description</th>
   </tr>
<tr>
   <td>
      <a href="oversim.common.BaseOverlay.html">BaseOverlay</a>
      <i> (simple&nbsp;module)</i>
   </td>
   <td>

<p>Base class for overlay implementations</p>
   </td>
</tr>
</table>
<h3 class="subtitle">Source code:</h3>
<pre class="src"><span style="color: #808080; font-style: italic; ">//
// Copyright (C) 2006 Institut fuer Telematik, Universitaet Karlsruhe (TH)
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
//
</span><span style="color: #000000; ">
</span><span style="color: #800000; font-weight: bold; ">package</span><span style="color: #000000; "> </span><span style="color: #000000; ">oversim</span><span style="color: #000000; ">.</span><span style="color: #000000; ">common</span><span style="color: #000000; ">;

</span><span style="color: #808080; font-style: italic; ">//
// Base class for overlay implementations
//
// </span><span style="color: #000080; ">@author</span><span style="color: #808080; font-style: italic; "> Ingmar Baumgart, Bernhard Heep, Stephan Krause, Sebastian Mies
//
</span><span style="color: #800000; font-weight: bold; ">simple</span><span style="color: #000000; "> </span><span style="color: #000000; ">BaseOverlay</span><span style="color: #000000; "> </span><span style="color: #800000; font-weight: bold; ">extends</span><span style="color: #000000; "> </span><span style="color: #000000; ">BaseRpc</span><span style="color: #000000; ">
{
    </span><span style="color: #800000; font-weight: bold; ">parameters</span><span style="color: #000000; ">:
        </span><span style="color: #000000; font-weight: bold; ">@class</span><span style="color: #000000; ">(</span><span style="color: #000000; ">BaseOverlay</span><span style="color: #000000; ">);
        </span><span style="color: #000000; font-weight: bold; ">@display</span><span style="color: #000000; ">(</span><span style="color: #008000; ">&quot;i=block/circle&quot;</span><span style="color: #000000; ">);
        </span><span style="color: #000080; font-weight: bold; ">int</span><span style="color: #000000; "> </span><span style="color: #000000; ">localPort</span><span style="color: #000000; ">; </span><span style="color: #808080; font-style: italic; ">// UDP port for overlay messages
</span><span style="color: #000000; ">        </span><span style="color: #000080; font-weight: bold; ">bool</span><span style="color: #000000; "> </span><span style="color: #000000; ">debugOutput</span><span style="color: #000000; ">; </span><span style="color: #808080; font-style: italic; ">// enable debug output
</span><span style="color: #000000; ">        </span><span style="color: #000080; font-weight: bold; ">int</span><span style="color: #000000; "> </span><span style="color: #000000; ">keyLength</span><span style="color: #000000; ">; </span><span style="color: #808080; font-style: italic; ">// overlay key length in bits
</span><span style="color: #000000; ">        </span><span style="color: #000080; font-weight: bold; ">string</span><span style="color: #000000; "> </span><span style="color: #000000; ">nodeId</span><span style="color: #000000; ">; </span><span style="color: #808080; font-style: italic; ">// optional nodeId as string in hexadecimal notation 
</span><span style="color: #000000; ">        </span><span style="color: #000080; font-weight: bold; ">bool</span><span style="color: #000000; "> </span><span style="color: #000000; ">useCommonAPIforward</span><span style="color: #000000; ">; </span><span style="color: #808080; font-style: italic; ">// enable CommonAPI forward() calls
</span><span style="color: #000000; ">        </span><span style="color: #000080; font-weight: bold; ">bool</span><span style="color: #000000; "> </span><span style="color: #000000; ">drawOverlayTopology</span><span style="color: #000000; ">; </span><span style="color: #808080; font-style: italic; ">// draw arrow to successor node?
</span><span style="color: #000000; ">        </span><span style="color: #000080; font-weight: bold; ">int</span><span style="color: #000000; "> </span><span style="color: #000000; ">hopCountMax</span><span style="color: #000000; ">; </span><span style="color: #808080; font-style: italic; ">// maximum number of overlay hops
</span><span style="color: #000000; ">        </span><span style="color: #000080; font-weight: bold; ">int</span><span style="color: #000000; "> </span><span style="color: #000000; ">recNumRedundantNodes</span><span style="color: #000000; ">; </span><span style="color: #808080; font-style: italic; ">// numRedundantNodes for recursive routing
</span><span style="color: #000000; ">        </span><span style="color: #000080; font-weight: bold; ">bool</span><span style="color: #000000; "> </span><span style="color: #000000; ">joinOnApplicationRequest</span><span style="color: #000000; ">; </span><span style="color: #808080; font-style: italic; ">// only join the overlay on application request
</span><span style="color: #000000; ">        </span><span style="color: #000080; font-weight: bold; ">bool</span><span style="color: #000000; "> </span><span style="color: #000000; ">collectPerHopDelay</span><span style="color: #000000; ">; </span><span style="color: #808080; font-style: italic; ">// delay statistics for single hops
</span><span style="color: #000000; ">        </span><span style="color: #000080; font-weight: bold; ">bool</span><span style="color: #000000; "> </span><span style="color: #000000; ">routeMsgAcks</span><span style="color: #000000; ">; </span><span style="color: #808080; font-style: italic; ">// use RPCs for route messages
</span><span style="color: #000000; ">        </span><span style="color: #000080; font-weight: bold; ">int</span><span style="color: #000000; "> </span><span style="color: #000000; ">lookupRedundantNodes</span><span style="color: #000000; ">; </span><span style="color: #808080; font-style: italic; ">// number of next hops in each step
</span><span style="color: #000000; ">        </span><span style="color: #000080; font-weight: bold; ">int</span><span style="color: #000000; "> </span><span style="color: #000000; ">lookupParallelPaths</span><span style="color: #000000; ">; </span><span style="color: #808080; font-style: italic; ">// number of parallel paths
</span><span style="color: #000000; ">        </span><span style="color: #000080; font-weight: bold; ">int</span><span style="color: #000000; "> </span><span style="color: #000000; ">lookupParallelRpcs</span><span style="color: #000000; ">; </span><span style="color: #808080; font-style: italic; ">// number of nodes to ask in parallel      
</span><span style="color: #000000; ">        </span><span style="color: #000080; font-weight: bold; ">bool</span><span style="color: #000000; "> </span><span style="color: #000000; ">lookupVerifySiblings</span><span style="color: #000000; ">; </span><span style="color: #808080; font-style: italic; ">//true, if siblings need to be authenticated with a ping
</span><span style="color: #000000; ">        </span><span style="color: #000080; font-weight: bold; ">bool</span><span style="color: #000000; "> </span><span style="color: #000000; ">lookupMajoritySiblings</span><span style="color: #000000; ">; </span><span style="color: #808080; font-style: italic; ">// true, if sibling candidates are selected by a majority decision if using parallel paths  
</span><span style="color: #000000; ">        </span><span style="color: #000080; font-weight: bold; ">bool</span><span style="color: #000000; "> </span><span style="color: #000000; ">lookupMerge</span><span style="color: #000000; ">; </span><span style="color: #808080; font-style: italic; ">// true, if parallel Rpc results should be merged
</span><span style="color: #000000; ">        </span><span style="color: #000080; font-weight: bold; ">bool</span><span style="color: #000000; "> </span><span style="color: #000000; ">lookupFailedNodeRpcs</span><span style="color: #000000; ">; </span><span style="color: #808080; font-style: italic; ">// communicate failed nodes
</span><span style="color: #000000; ">        </span><span style="color: #000080; font-weight: bold; ">bool</span><span style="color: #000000; "> </span><span style="color: #000000; ">lookupStrictParallelRpcs</span><span style="color: #000000; ">; </span><span style="color: #808080; font-style: italic; ">// limited the number of concurrent rpcs to parameter parallelRpcs
</span><span style="color: #000000; ">        </span><span style="color: #000080; font-weight: bold; ">bool</span><span style="color: #000000; "> </span><span style="color: #000000; ">lookupUseAllParallelResponses</span><span style="color: #000000; ">; </span><span style="color: #808080; font-style: italic; ">// merge all parallel responses from earlier steps
</span><span style="color: #000000; ">        </span><span style="color: #000080; font-weight: bold; ">bool</span><span style="color: #000000; "> </span><span style="color: #000000; ">lookupNewRpcOnEveryTimeout</span><span style="color: #000000; ">; </span><span style="color: #808080; font-style: italic; ">// send a new RPC immediately after an RPC timeouts
</span><span style="color: #000000; ">        </span><span style="color: #000080; font-weight: bold; ">bool</span><span style="color: #000000; "> </span><span style="color: #000000; ">lookupNewRpcOnEveryResponse</span><span style="color: #000000; ">; </span><span style="color: #808080; font-style: italic; ">// send a new RPC after every response, even if there was no progress
</span><span style="color: #000000; ">        </span><span style="color: #000080; font-weight: bold; ">bool</span><span style="color: #000000; "> </span><span style="color: #000000; ">lookupFinishOnFirstUnchanged</span><span style="color: #000000; ">; </span><span style="color: #808080; font-style: italic; ">// finish lookup, if the last pending RPC returned without progress    
</span><span style="color: #000000; ">        </span><span style="color: #000080; font-weight: bold; ">bool</span><span style="color: #000000; "> </span><span style="color: #000000; ">lookupVisitOnlyOnce</span><span style="color: #000000; ">; </span><span style="color: #808080; font-style: italic; ">// if true, the same node is never asked twice during a single lookup
</span><span style="color: #000000; ">        </span><span style="color: #000080; font-weight: bold; ">bool</span><span style="color: #000000; "> </span><span style="color: #000000; ">lookupAcceptLateSiblings</span><span style="color: #000000; ">; </span><span style="color: #808080; font-style: italic; ">// if true, a FindNodeResponse with sibling flag set is always accepted, even if it is from a previous lookup step
</span><span style="color: #000000; ">        </span><span style="color: #000080; font-weight: bold; ">string</span><span style="color: #000000; "> </span><span style="color: #000000; ">routingType</span><span style="color: #000000; ">; </span><span style="color: #808080; font-style: italic; ">// default routing mode (iterative, semi-recursive,...)
</span><span style="color: #000000; ">        </span><span style="color: #000080; font-weight: bold; ">bool</span><span style="color: #000000; "> </span><span style="color: #000000; ">rejoinOnFailure</span><span style="color: #000000; ">; </span><span style="color: #808080; font-style: italic; ">// rejoin after loosing connection to the overlay?
</span><span style="color: #000000; ">        </span><span style="color: #000080; font-weight: bold; ">bool</span><span style="color: #000000; "> </span><span style="color: #000000; ">sendRpcResponseToLastHop</span><span style="color: #000000; ">; </span><span style="color: #808080; font-style: italic; ">// needed by KBR protocols for NAT support
</span><span style="color: #000000; ">        </span><span style="color: #000080; font-weight: bold; ">bool</span><span style="color: #000000; "> </span><span style="color: #000000; ">recordRoute</span><span style="color: #000000; ">; </span><span style="color: #808080; font-style: italic; ">// record visited hops on route 
</span><span style="color: #000000; ">
        </span><span style="color: #000080; font-weight: bold; ">bool</span><span style="color: #000000; "> </span><span style="color: #000000; ">dropFindNodeAttack</span><span style="color: #000000; ">; </span><span style="color: #808080; font-style: italic; ">// if node is malicious, it tries a findNode attack
</span><span style="color: #000000; ">        </span><span style="color: #000080; font-weight: bold; ">bool</span><span style="color: #000000; "> </span><span style="color: #000000; ">isSiblingAttack</span><span style="color: #000000; ">; </span><span style="color: #808080; font-style: italic; ">// if node is malicious, it tries a isSibling attack
</span><span style="color: #000000; ">        </span><span style="color: #000080; font-weight: bold; ">bool</span><span style="color: #000000; "> </span><span style="color: #000000; ">invalidNodesAttack</span><span style="color: #000000; ">; </span><span style="color: #808080; font-style: italic; ">// if node is malicious, it tries a invalidNode attack
</span><span style="color: #000000; ">        </span><span style="color: #000080; font-weight: bold; ">bool</span><span style="color: #000000; "> </span><span style="color: #000000; ">dropRouteMessageAttack</span><span style="color: #000000; ">; </span><span style="color: #808080; font-style: italic; ">// if node is malicious, it drops all received BaseRouteMessages
</span><span style="color: #000000; ">        </span><span style="color: #000080; font-weight: bold; ">bool</span><span style="color: #000000; "> </span><span style="color: #000000; ">measureAuthBlock</span><span style="color: #000000; ">; </span><span style="color: #808080; font-style: italic; ">// if true, measure the overhead of signatures in rpc messages
</span><span style="color: #000000; ">        </span><span style="color: #000080; font-weight: bold; ">bool</span><span style="color: #000000; "> </span><span style="color: #000000; ">restoreContext</span><span style="color: #000000; ">; </span><span style="color: #808080; font-style: italic; ">// if true, a node rejoins with its old nodeId and malicious state
</span><span style="color: #000000; ">
    </span><span style="color: #800000; font-weight: bold; ">gates</span><span style="color: #000000; ">:
        </span><span style="color: #000080; font-weight: bold; ">input</span><span style="color: #000000; "> </span><span style="color: #000000; ">udpIn</span><span style="color: #000000; ">; </span><span style="color: #808080; font-style: italic; ">// gate from the UDP layer
</span><span style="color: #000000; ">        </span><span style="color: #000080; font-weight: bold; ">output</span><span style="color: #000000; "> </span><span style="color: #000000; ">udpOut</span><span style="color: #000000; ">; </span><span style="color: #808080; font-style: italic; ">// gate to the UDP layer
</span><span style="color: #000000; ">        </span><span style="color: #000080; font-weight: bold; ">input</span><span style="color: #000000; "> </span><span style="color: #000000; ">tcpIn</span><span style="color: #000000; ">; </span><span style="color: #808080; font-style: italic; ">// gate from the TCP layer
</span><span style="color: #000000; ">        </span><span style="color: #000080; font-weight: bold; ">output</span><span style="color: #000000; "> </span><span style="color: #000000; ">tcpOut</span><span style="color: #000000; ">; </span><span style="color: #808080; font-style: italic; ">// gate to the TCP layer
</span><span style="color: #000000; ">        </span><span style="color: #000080; font-weight: bold; ">input</span><span style="color: #000000; "> </span><span style="color: #000000; ">appIn</span><span style="color: #000000; ">; </span><span style="color: #808080; font-style: italic; ">// gate from the application
</span><span style="color: #000000; ">        </span><span style="color: #000080; font-weight: bold; ">output</span><span style="color: #000000; "> </span><span style="color: #000000; ">appOut</span><span style="color: #000000; ">; </span><span style="color: #808080; font-style: italic; ">// gate to the application
</span><span style="color: #000000; ">        </span><span style="color: #000080; font-weight: bold; ">input</span><span style="color: #000000; "> </span><span style="color: #000000; ">direct_in</span><span style="color: #000000; ">; </span><span style="color: #808080; font-style: italic; ">// gate for sendDirect
</span><span style="color: #000000; ">}

</span></pre>
   <hr><p class="footer"><a href="http://creativecommons.org/licenses/by-sa/3.0" target="_top"><img src="by-sa.png"></a> This documentation is released under the <a href="http://creativecommons.org/licenses/by-sa/3.0" target="_top">Creative Commons license</a></p>
   </body>
</html>
